package Class.Advance.Inherit.Basis;

class Example1{
    public void sayHi(){
        System.out.println("Hi!");
    }
}

class Example2 extends Example1{
    public void sayHello(){
        System.out.println("Hello!");
    }
}

public class Basis {
    public static void main(String[] args) {
        Example2 example = new Example2();
        //子类可以访问父类中的public方法
        example.sayHi();
        example.sayHello();
    }
}
